local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local GoldenbrandSpear = Character:WaitForChild("Goldenbrand Spear") --这里改你现在准备的刀idk不会的去丢给ai
local ActivatedRemote = GoldenbrandSpear:WaitForChild("ActivatedRemote")
local DeactivatedRemote = GoldenbrandSpear:WaitForChild("DeactivatedRemote")
local Melee = GoldenbrandSpear:WaitForChild("Melee")
local SlashTrail = Melee:WaitForChild("Components"):WaitForChild("SlashTrail"):WaitForChild("Trail")
local SetSlashTrailEnabled = ReplicatedStorage:WaitForChild("Events"):WaitForChild("SetSlashTrailEnabled")
local DealMeleeDamage = ReplicatedStorage:WaitForChild("Events"):WaitForChild("DealMeleeDamage")

while true do
    ActivatedRemote:FireServer()
    DeactivatedRemote:FireServer()
    local args = {{SlashTrail, SlashTrail}, true}
    SetSlashTrailEnabled:FireServer(unpack(args))
    
    local rootPart = Character:FindFirstChild("HumanoidRootPart")
    if rootPart then
        local position = rootPart.Position
        local radius = 50
        local region = Region3.new(position - Vector3.new(radius, radius, radius), position + Vector3.new(radius, radius, radius))
        local parts = workspace:FindPartsInRegion3(region, Character, 100)
        
        local humanoids = {}
        for _, part in ipairs(parts) do
            local humanoid = part.Parent:FindFirstChildOfClass("Humanoid")
            if humanoid and not table.find(humanoids, humanoid) then
                table.insert(humanoids, humanoid)
            end
        end
        
        for _, humanoid in ipairs(humanoids) do
            local target = humanoid.Parent
            local rightLeg = target:FindFirstChild("Right Leg") or target:FindFirstChild("RightFoot")
            if rightLeg then
                local args = {humanoid, rightLeg, 1, false}
                DealMeleeDamage:FireServer(unpack(args))
            end
        end
    end
    
    task.wait(0.1)
end
